import BaseXform from '../base-xform';

class BooleanXform extends BaseXform {
    constructor(options) {
        super();

        this.tag = options.tag;
        this.attr = options.attr;
    }

    render(xmlStream, model) {
        if (model) {
            xmlStream.openNode(this.tag);
            xmlStream.closeNode();
        }
    }

    parseXmlObject(node) {
        if (node._name === this.tag) {
            this.model = true;
            return true;
        }
        return false;
    }

    parseOpen(node) {
        if (node.name === this.tag) {
            this.model = true;
        }
    }

    parseText() {
    }

    parseClose() {
        return false;
    }
}

export default BooleanXform;
